home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / syscall / RCS / Ioc_Lock.c,v < prev    next >
Encoding:
Text File  |  1991-12-11  |  2.2 KB  |  100 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.1.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     88.06.19.14.29.19;  author ouster;  state Exp;
  11. branches 1.1.1.1;
  12. next     ;
  13.  
  14. 1.1.1.1
  15. date     91.12.10.16.50.27;  author kupfer;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24.  
  25. 1.1
  26. log
  27. @Initial revision
  28. @
  29. text
  30. @/* 
  31.  * Ioc_Lock.c --
  32.  *
  33.  *    Source code for the Ioc_Lock library procedure.
  34.  *
  35.  * Copyright 1988 Regents of the University of California
  36.  * Permission to use, copy, modify, and distribute this
  37.  * software and its documentation for any purpose and without
  38.  * fee is hereby granted, provided that the above copyright
  39.  * notice appear in all copies.  The University of California
  40.  * makes no representations about the suitability of this
  41.  * software for any purpose.  It is provided "as is" without
  42.  * express or implied warranty.
  43.  */
  44.  
  45. #ifndef lint
  46. static char rcsid[] = "$Header: proto.c,v 1.2 88/03/11 08:39:08 ouster Exp $ SPRITE (Berkeley)";
  47. #endif not lint
  48.  
  49. #include <sprite.h>
  50. #include <fs.h>
  51.  
  52.  
  53. /*
  54.  *----------------------------------------------------------------------
  55.  *
  56.  * Ioc_Lock --
  57.  *    Lock the device behind the stream.  The flags specify if the
  58.  *    lock is shared (IOC_LOCK_SHARED) or exclusive (IOC_LOCK_EXCLUSIVE).
  59.  *    A shared lock can co-exist with other shared locks, but not with
  60.  *    any exclusive locks.  Exclusive can't co-exist with any other locks.
  61.  *    If the lock can't be obtained right away, the process gets blocked
  62.  *    unless the IOC_LOCK_NO_BLOCK flag is specified.  In this case
  63.  *    FS_WOULD_BLOCK gets returned if the lock can't be taken.
  64.  *
  65.  * Results:
  66.  *    SUCCESS or FS_WOULD_BLOCK
  67.  *
  68.  * Side effects:
  69.  *    Grabs the lock associated with the device underlying the stream.
  70.  *
  71.  *----------------------------------------------------------------------
  72.  */
  73.  
  74. ReturnStatus
  75. Ioc_Lock(streamID, flags)
  76.     int streamID;
  77.     int flags;
  78. {
  79.     register ReturnStatus status;
  80.     Ioc_LockArgs args;
  81.  
  82.     args.flags = flags;
  83.  
  84.     status = Fs_IOControl(streamID, IOC_LOCK, sizeof(Ioc_LockArgs),
  85.             (Address)&args, 0, (Address)NULL);
  86.     return(status);
  87. }
  88. @
  89.  
  90.  
  91. 1.1.1.1
  92. log
  93. @Initial branch for Sprite server.
  94. @
  95. text
  96. @d17 1
  97. a17 1
  98. static char rcsid[] = "$Header: /sprite/src/lib/c/syscall/RCS/Ioc_Lock.c,v 1.1 88/06/19 14:29:19 ouster Exp $ SPRITE (Berkeley)";
  99. @
  100.